# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# This file is based on the AUR rtl8814au-aircrack-dkms package
# AUR Maintainer:  b00rt00s <b00rt00s.aur@gmail.com>
# AUR Contributor: Iyán Méndez Veiga <me (at) iyanmv (dot) com>
# AUR Contributor: Shaun Ren <shaun DOT ren (at) linux (dOt) com>
# AUR Contributor: Simon Hanna <simon DOT hanna (at) serve-me (dOt) info>

pkgname=rtl8812au-aircrack-dkms
_pkgname=rtl8812au
pkgver=1312.c3fb89a
pkgrel=1
pkgdesc='Aircrack-ng kernel module for Realtek (USB adapters only) network cards with 8812au chipset.'
url='https://github.com/aircrack-ng/rtl8812au'
license=('GPL')
arch=('x86_64' 'aarch64')
makedepends=('git')
depends=('dkms')
replaces=('rtl8812au-dkms-git')
conflicts=('rtl8812au-dkms-git')
source=("git+https://github.com/aircrack-ng/$_pkgname.git"
        'dkms.conf')
sha512sums=('SKIP'
            '0da63bce628eca7713067373a71e17f33d812ee28543481b12ca53394f167c7c72637350cf5fa3b4a98d3917756bda302ca604e8c7bbb4d4dee6a788ce201356')

pkgver() {
  cd $_pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  # Set name and version
  sed -e "s/@_PKGBASE@/$_pkgname-dkms/" \
  -e "s/@PKGVER@/$pkgver/" \
  -i dkms.conf
}

package() {
  cd $_pkgname

  install -Dm 755 "$srcdir/dkms.conf" \
    "$pkgdir/usr/src/$_pkgname-$pkgver/dkms.conf"

  cp -r * "$pkgdir/usr/src/$_pkgname-$pkgver"
}

